import 'dart:convert' show json;

class MusicChannelGg {
  int code;
  String message;
  ChannelGg result;

  MusicChannelGg.fromParams({this.code, this.message, this.result});

  factory MusicChannelGg(jsonStr) => jsonStr == null
      ? null
      : jsonStr is String
          ? new MusicChannelGg.fromJson(json.decode(jsonStr))
          : new MusicChannelGg.fromJson(jsonStr);

  MusicChannelGg.fromJson(jsonRes) {
    code = jsonRes['code'];
    message = jsonRes['message'];
    result = jsonRes['result'] == null
        ? null
        : new ChannelGg.fromJson(jsonRes['result']);
  }

  @override
  String toString() {
    return '{"code": $code,"message": ${message != null ? '${json.encode(message)}' : 'null'},"result": $result}';
  }
}

class ChannelGg {
  String artistid;
  String avatar;
  String channelid;
  String count;
  String ch_name;
  String channel;
  List<ChannelItem> songlist;

  ChannelGg.fromParams(
      {this.artistid,
      this.avatar,
      this.channelid,
      this.count,
      this.ch_name,
      this.channel,
      this.songlist});

  ChannelGg.fromJson(jsonRes) {
    artistid = jsonRes['artistid'];
    avatar = jsonRes['avatar'];
    channelid = jsonRes['channelid'];
    count = jsonRes['count'];
    ch_name = jsonRes['ch_name'];
    channel = jsonRes['channel'];
    songlist = jsonRes['songlist'] == null ? null : [];

    for (var songlistItem in songlist == null ? [] : jsonRes['songlist']) {
      songlist.add(
          songlistItem == null ? null : new ChannelItem.fromJson(songlistItem));
    }
  }

  @override
  String toString() {
    return '{"artistid": ${artistid != null ? '${json.encode(artistid)}' : 'null'},"avatar": ${avatar != null ? '${json.encode(avatar)}' : 'null'},"channelid": ${channelid != null ? '${json.encode(channelid)}' : 'null'},"count": ${count != null ? '${json.encode(count)}' : 'null'},"ch_name": ${ch_name != null ? '${json.encode(ch_name)}' : 'null'},"channel": ${channel != null ? '${json.encode(channel)}' : 'null'},"songlist": $songlist}';
  }
}

class ChannelItem {
  int charge;
  int flow;
  int havehigh;
  int method;
  String all_artist_id;
  String all_rate;
  String artist;
  String artist_id;
  String resource_type;
  String songid;
  String thumb;
  String title;

  ChannelItem.fromParams(
      {this.charge,
      this.flow,
      this.havehigh,
      this.method,
      this.all_artist_id,
      this.all_rate,
      this.artist,
      this.artist_id,
      this.resource_type,
      this.songid,
      this.thumb,
      this.title});

  ChannelItem.fromJson(jsonRes) {
    charge = jsonRes['charge'];
    flow = jsonRes['flow'];
    havehigh = jsonRes['havehigh'];
    method = jsonRes['method'];
    all_artist_id = jsonRes['all_artist_id'];
    all_rate = jsonRes['all_rate'];
    artist = jsonRes['artist'];
    artist_id = jsonRes['artist_id'];
    resource_type = jsonRes['resource_type'];
    songid = jsonRes['songid'];
    thumb = jsonRes['thumb'];
    title = jsonRes['title'];
  }

  @override
  String toString() {
    return '{"charge": $charge,"flow": $flow,"havehigh": $havehigh,"method": $method,"all_artist_id": ${all_artist_id != null ? '${json.encode(all_artist_id)}' : 'null'},"all_rate": ${all_rate != null ? '${json.encode(all_rate)}' : 'null'},"artist": ${artist != null ? '${json.encode(artist)}' : 'null'},"artist_id": ${artist_id != null ? '${json.encode(artist_id)}' : 'null'},"resource_type": ${resource_type != null ? '${json.encode(resource_type)}' : 'null'},"songid": ${songid != null ? '${json.encode(songid)}' : 'null'},"thumb": ${thumb != null ? '${json.encode(thumb)}' : 'null'},"title": ${title != null ? '${json.encode(title)}' : 'null'}}';
  }
}
